import { BaseData } from '@shared/models/base-data';
import { PageComponent } from '@shared/components/page.component';
import { Directive, Input } from '@angular/core';
import { PageLink } from '@shared/models/page/page-link';
import { TableConfig } from '@shared/models/table/table-config.models';

@Directive()
export abstract class TableHeaderComponent<T extends BaseData,
  P extends PageLink = PageLink,
  L extends BaseData = T,
  C extends TableConfig<T, P, L> = TableConfig<T, P, L>>
  extends PageComponent {

  private tableConfigValue!: C; // 表格配置对象（通过 @Input setter 设置）

  @Input()
  set tableConfig(tableConfig: C) {
    this.setTableConfig(tableConfig);
  }

  get tableConfig(): C {
    return this.tableConfigValue;
  }

  protected setTableConfig(tableConfig: C): void {
    this.tableConfigValue = tableConfig;
  }
}
